
#include<iostream>
#include<algorithm>

using namespace std;

struct node 
{
	double weight;
	double value;
	double cost_eff;
};

bool compare(node a, node b)
{
	return a.cost_eff > b.cost_eff;
}

double solution(int n, double W,node s[])
{
	double sum = 0;
	double surplus_capa = W;
	for (size_t i = 0; i < n; ++i)
	{
		if (s[i].weight <= surplus_capa)
		{
			surplus_capa -= s[i].weight;
			sum += s[i].value;
		}
		else
		{
			sum += s[i].cost_eff * surplus_capa;
		}
	}
	return sum;
}

int main()
{
	
}